package domaine;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import enumere.Couleur;

@Entity
@Table(name = "ACTIONS", schema = "ZELDAVOLO")
public class Action implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;

	@NotNull
	@Min(0)
	@Max(5)
	private int gemmeRestantes;

	@Enumerated(EnumType.STRING)
	private Couleur linkChoisis;

	protected Action() {
		// TODO Auto-generated constructor stub
	}
	public Action(int gemmes){
		this.gemmeRestantes = gemmes;
	}
	public int getId() {
		return id;
	}

	public int getGemmeRestantes() {
		return gemmeRestantes;
	}

	public void setGemmeRestantes(int gemmeRestantes) {
		this.gemmeRestantes = gemmeRestantes;
	}	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}	
	public Couleur getLinkChoisis() {
		return linkChoisis;
	}
	public void setLinkChoisis(Couleur linkChoisis) {
		this.linkChoisis = linkChoisis;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Action other = (Action) obj;
		if (id != other.id)
			return false;
		return true;
	}

}
